<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script language="javascript">
$(document).ready(function(){
	$("#fechaNac").blur(function(){		
		var x = $("#fechaNac").val();
		var xDia = x.substring(0,2);
		var xMes = x.substring(3,5);
		var xAnio = x.substring(6,10);
		var age = 18;
		var mydate = new Date();
		mydate.setFullYear(xAnio, xMes-1, xDia);
		var currdate = new Date();
		currdate.setFullYear(currdate.getFullYear() - age);
		if ((currdate - mydate) < 0){
			alert("Solo pueden registrarse personas mayores de " + age + " años de edad");
			return false;
		}
		return true;
	});
});
</script>
</head>

<body>
<form name="fech" id="fech">
	<input name="fechaNac" type="text" id="fechaNac" size="20" />
  <!--  <input name="month" type="text" id="month" />
    <input name="year" type="text" id="year" size="40" /> -->
    <input type="button" id="boton" value="calcular" />
</form>
</body>
</html>
